package logic

import (
	"yk/common/proto/user"
	"yk/rpc/server"
)

type UserGrpc struct {
	user.UnimplementedUserServer
}

func (u UserGrpc) Send(in *user.SendRequest) (*user.SendResponse, error) {
	sms, err := server.SendSms(in)
	if err != nil {
		return nil, err
	}
	return sms, nil
}

func (u UserGrpc) Reg(in *user.RegRequest) (*user.RegResponse, error) {
	reg, err := server.Reg(in)
	if err != nil {
		return nil, err
	}
	return reg, nil
}

func (u UserGrpc) Login(in *user.LoginRequest) (*user.LoginResponse, error) {
	login, err := server.Login(in)
	if err != nil {
		return nil, err
	}
	return login, nil
}

func (u UserGrpc) Update(in *user.UpdateRequest) (*user.UpdateResponse, error) {
	update, err := server.Update(in)
	if err != nil {
		return nil, err
	}
	return update, nil
}

func (u UserGrpc) UserXy(in *user.UserXyRequest) (*user.UserXyResponse, error) {
	xy, err := server.UserXy(in)
	if err != nil {
		return nil, err
	}
	return xy, nil
}

func (u UserGrpc) OrderCarList(in *user.OrderCarListRequest) (*user.OrderCarListResponse, error) {
	list, err := server.OrderCarList(in)
	if err != nil {
		return nil, err
	}
	return list, nil
}

func (u UserGrpc) CakeCar(in *user.TakeCreateRequest) (*user.TakeCreateResponse, error) {
	create, err := server.TakeCreate(in)
	if err != nil {
		return nil, err
	}
	return create, nil
}

func (u UserGrpc) EvaCreate(in *user.EvaCreateRequest) (*user.EvaCreateResponse, error) {
	create, err := server.EvaCreate(in)
	if err != nil {
		return nil, err
	}
	return create, nil
}
